package com.example.android.wiktionary;

import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ListView;

public class MainMenu extends ListActivity {

	/** Called when the activity is first created. */
	
	public void onCreate(Bundle icicle) {
		super.onCreate(icicle);
		// Create an array of Strings, that will be put to our ListActivity
		String[] names = new String[] { "Play", "Settings", "Help", "Credits"};
		this.setListAdapter(new MyArrayAdapter(this, names));
	}

	@Override
	protected void onListItemClick(ListView l, View v, int position, long id) {
		super.onListItemClick(l, v, position, id);
		// Get the item that was clicked
		Object o = this.getListAdapter().getItem(position);
		String keyword = o.toString();
		
		if (0 == keyword.compareToIgnoreCase("Play")){
			Intent intent = new Intent(getApplicationContext(), InGameMenu.class);
			this.startActivity(intent);
		}
		else if (0 == keyword.compareToIgnoreCase("Settings")){
			Intent intent = new Intent(getApplicationContext(), SettingsPage.class);
			this.startActivity(intent);
		}
		else if (0 == keyword.compareToIgnoreCase("Help")){
			Intent intent = new Intent(getApplicationContext(), HelpPage.class);
			this.startActivity(intent);
		}
		else if (0 == keyword.compareToIgnoreCase("Credits")){
			Intent intent = new Intent(getApplicationContext(), CreditsPage.class);
			this.startActivity(intent);
		}
	}
}